<!-- 删除模态 -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalTitle" aria-hidden="true">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="关闭"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="deleteModalTitle">警告</h4>
      </div>
      <div class="modal-body">
        <h4 class="text-center">您确定要删除该内容？</h4>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
        <button ng-disabled="transmitting" ng-click="deleteContent()" type="button" class="btn btn-danger">确认删除</button>
      </div>
    </div>
  </div>
</div>

<!-- 主体 -->
<div ui-view class="view clearfix">
  <div class="page-header clearfix">
    <ol class="heading pull-left">
      <li><a ui-sref="main.contents">{{category.name}}</a></li>
    </ol>
    <a ng-if="editAuth" ui-sref="main.contents.create" class="btn btn-primary btn-sm pull-right"><i class="fa fa-pencil"></i> 新增内容</a >
  </div>
  <div class="panel panel-default clear-bottom-margin">
    <div class="panel-body table-responsive">
      <table class="table table-hover">
        <thead class="text-center">
          <tr>
            <th ng-if="$parent.category.model.system.thumbnail">缩略图</th>
            <th>标题</th>
            <th>阅读量</th>
            <th>发布人</th>
            <th>状态</th>
            <th>发布时间</th>
            <th ng-if="editAuth">操作</th>
          </tr>
        </thead>
        <tbody class="text-center text-middle">
          <tr ng-repeat="content in contents">
            <td ng-if="$parent.$parent.category.model.system.thumbnail" width="90">
              <div ng-if="content.thumbnail" class="list-thumbnail"><img ng-src="{{content.thumbnail.src}}"></div>
              <div ng-if="!content.thumbnail">-</div>
            </td>
            <td class="text-left"><a href="{{content.url}}" title="{{content.title}}" target="_blank">{{content.title | words: 30 }} <i class="fa fa-external-link"></i></a></td>
            <td>{{content.reading.total}}</td>
            <td>{{content.user.nickname}}</td>
            <td>{{content.status | translate: { display: 'name', same: 'value', source: statusType } }}</td>
            <td>{{content.status !== 'pushed' ? '-' : content.date | date: 'yyyy年MM月dd日'}}</td>
            <td ng-if="editAuth">
              <a ng-disabled="transmitting" ng-click="transmitting ? $event.preventDefault() : false" ui-sref="main.contents.update({ category: content.category._id, content: content._id })" class="btn btn-default btn-xs"><i class="fa fa-edit"></i> 修改</a>
              <button ng-disabled="transmitting" ng-click="$parent.$parent.$parent.deleteContentId = content._id" class="btn btn-default btn-xs" type="button" data-toggle="modal" data-target="#deleteModal"><i class="fa fa-trash-o"></i> 删除</button>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
  <nd-pagination current-page="$parent.currentPage" total-pages="$parent.totalPages" class="pull-right"></nd-pagination>
</div>